from threading import Thread
import time


class MyThread(Thread):
    def run(self):
        """run里面编写线程运行时要执行的任务代码"""
        time.sleep(2)
        print(f'{self.name}子线程运行了!')


if __name__ == '__main__':
    t = MyThread()
    t.start()
